﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Jemgine.Particles.Modifiers
{
    public class ColorLerp : Modifier
    {
        public Vector4 StartColor { get; set; }
        public Vector4 EndColor { get; set; }

        public ColorLerp()
        {
            StartColor = Vector4.One;
            EndColor = Vector4.One;
        }

        internal override void Apply(ref Particle _particle, Emitter _emitter, float ElapsedSeconds)
        {
            Vector4 Step = (EndColor - StartColor) / (_emitter.ParticleLifetime);
            _particle.color = StartColor + (_particle.age * Step);
        }
    }
}
